package com.lottery.game.controller.v2.pay.requestVO;

import com.lottery.game.common.exception.BaseException;
import com.lottery.game.controller.v2.find.request.MessageCodeTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;

/**
 * @author : yinlin
 * @version : 1.0
 * @date : 2018/11/11 8:32 AM
 * @Description :
 * @Copyright : Copyright (c) 2018
 * @Company : KeRuYun Technology(Beijing) Chengdu Co. Ltd.
 * @link : com.vpay.exchange.core.model.dto.FindPasswordTO
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(description = "找回密码实体")
public class FindPayPasswordTO extends MessageCodeTO {

    @NotEmpty(message = "密码不能为空")
    @ApiModelProperty(required = true, name = "password", value = "密码")
    @Length(min = 6, max = 6, message="密码必须6位数字")
    private String password;

    @NotEmpty(message = "确认密码不能为空")
    @ApiModelProperty(required = true, name = "rePassword", value = "确认密码")
    @Length(min = 6, max = 6, message="密码必须6位数字")
    private String rePassword;

    public void validate() {
        if (!password.equals(rePassword)) {
            throw new BaseException("两次登陆密码不一致");
        }
    }
}
